package com.io.example.demoparent.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 *
 * @TableName user
 */
@Data
public class User implements Serializable {
    /**
     *
     */
    private Integer id;

    /**
     *用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Length(message = "用户名长度不能超过{max}个字符", max = 10)
    private String userName;

    /**
     * 电话
     */
    @Pattern(regexp = "^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$", message = "手机号码有误！")
    private String tel;
    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Size(message = "密码不小于{min}位", min = 8)
    private String password;
    /**
     * 年龄
     */
    @NotNull(message = "请输入年龄")
    @Range(message = "年龄范围为 {min} 到 {max} 之间", min = 1, max = 100)
    private Integer age;

    /**
     *
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createDate;

    /**
     *
     */
    private String headImg;

    /**
     *
     */
    private Integer deptId;
    private static final long serialVersionUID = 1L;

}